<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui"
	xmlns:ui="http://java.sun.com/jsf/facelets">
<h:head>
</h:head>
<h:body>
	<h:form id="formListaSP">
		<div align="center" class="DivCentralizada"
			style="left: 50%; margin-left: -500px; height: 110px;">
			<div align="center"
				style="padding-left: 59px; float: left; padding-right: 24px;">
				<h:outputLabel value="#{message.produto_dt_necessidade} De "
					styleClass="LabelFont" />
				<p:inputMask value="#{listaSolicitaProdTela.dataDeFiltro}" size="5"
					maxlength="8" style="font-size: 14px;" mask="99/99/99"
					required="true" requiredMessage="#{message.msg_requerido}">
				</p:inputMask>
			</div>
			<div align="center" style="float: left;">
				<h:outputLabel value=" #{message.produto_dt_necessidade} Até "
					styleClass="LabelFont" />
				<p:inputMask value="#{listaSolicitaProdTela.dataAteFiltro}" size="5"
					maxlength="8" style="font-size: 14px;" mask="99/99/99"
					required="true" requiredMessage="#{message.msg_requerido}">
				</p:inputMask>
			</div>

			<div align="center"
				style="padding-left: 25px; float: left; padding-right: 24px;">
				<h:outputLabel value="SP de " styleClass="LabelFont" />
				<p:inputText value="#{listaSolicitaProdTela.numDeFiltro}" size="5"
					maxlength="8" style="font-size: 14px;">
				</p:inputText>
			</div>
			<div align="center" style="float: left;">
				<h:outputLabel value="SP até " styleClass="LabelFont" />
				<p:inputText value="#{listaSolicitaProdTela.numAteFiltro}" size="5"
					maxlength="8" style="font-size: 14px;">
				</p:inputText>
			</div>

			<div align="center"
				style="clear: both; float: left; padding-right: 3px; padding-top: 8px; margin-left: 47px;">
				<h:outputLabel value="#{message.solicita_filial}"
					styleClass="LabelFont" style="margin-left:30px;" />
			</div>
			<div align="center"
				style="float: left; padding-right: 24px; padding-top: 4px;">

				<p:selectOneRadio value="#{listaSolicitaProdTela.opcaoFilial}"
					style="float:left;">
					<f:selectItem itemLabel="Origem" itemValue="ORIGEM" />
					<f:selectItem itemLabel="Produção" itemValue="PRODUCAO" />
				</p:selectOneRadio>

				<p:selectOneMenu value="#{listaSolicitaProdTela.filialFiltro}"
					effect="fade" style="font-size: 13px;">
					<f:selectItem itemLabel="" itemValue="" />
					<f:selectItems value="#{usuario.listaEmpresas}" var="empresa"
						itemLabel="#{empresa.descricao}" itemValue="#{empresa.filial}"
						style="font-size: 13px;" />
					<p:ajax global="false" />
				</p:selectOneMenu>
			</div>

			<div align="center"
				style="clear: both; float: left; padding-right: 3px; padding-top: 8px; margin-left: 47px;">
				<h:outputLabel value="#{message.label_linha}" styleClass="LabelFont"
					style="margin-left:30px;" />
			</div>
			<div align="center"
				style="float: left; padding-right: 24px; padding-top: 4px;">
				<p:selectOneMenu value="#{listaSolicitaProdTela.linhaFiltro}"
					effect="fade" style="font-size: 13px;">
					<f:selectItem itemLabel="Todas" itemValue="" />
					<f:selectItem
						itemLabel="#{message.label_linha} #{message.label_leve}"
						itemValue="I1" />
					<f:selectItem
						itemLabel="#{message.label_linha} #{message.label_pesada}"
						itemValue="I2" />
				</p:selectOneMenu>
			</div>

			<div align="center"
				style="float: left; padding-right: 3px; padding-top: 8px; margin-left: 47px;">
				<h:outputLabel value="#{message.solicita_status}"
					styleClass="LabelFont" style="margin-left:30px;" />
			</div>
			<div align="center"
				style="float: left; padding-right: 24px; padding-top: 4px;">
				<p:selectOneMenu value="#{listaSolicitaProdTela.statusFiltro}"
					effect="fade" style="font-size: 13px;">
					<f:selectItem itemLabel="Todas" itemValue="" />
					<f:selectItems value="#{listaSolicitaProdTela.listaStatusSp}"
						var="status" itemLabel="#{status.descricao}"
						itemValue="#{status.codigo}" />
				</p:selectOneMenu>
			</div>

			<div style="margin-top: 10px; margin-left: 150px; float: left;">
				<p:commandButton value="#{message.botao_filtrar}"
					icon="ui-icon-search" style="margin-left:30px; font-size: 14px;"
					update=":messages,:formDataSP"
					actionListener="#{listaSolicitaProdTela.filtrarSolicitacoesProd}" />
			</div>
		</div>
	</h:form>
	<h:form id="formDataSP">
		<p:dataTable value="#{listaSolicitaProdTela.listaSolicitacaoProducao}"
			var="sp" paginator="true" rows="10"
			rowsPerPageTemplate="10,15,30,50,100,200"
			paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
			emptyMessage="#{message.msg_semvalores}" style="margin-top:10px;">

			<p:column style="width:4%">
				<p:rowToggler />
			</p:column>

			<p:column sortBy="#{sp.empresaOrigem.filial}">
				<f:facet name="header">  
                    Fil O
            	</f:facet>
				<h:outputText value="#{sp.empresaOrigem.filial}" />
			</p:column>

			<p:column sortBy="#{sp.empresaProd.filial}">
				<f:facet name="header">  
                    Fil P 
            	</f:facet>
				<h:outputText value="#{sp.empresaProd.filial}" />
			</p:column>

			<p:column sortBy="#{sp.numeroSp}">
				<f:facet name="header">  
                   #{message.solicita_numero}  
            	</f:facet>
				<h:outputText value="#{sp.numeroSp}" />
			</p:column>

			<p:column sortBy="#{sp.produto.codigo}">
				<f:facet name="header">  
                   #{message.produto_produto}  
            	</f:facet>
				<h:outputText value="#{sp.produto.codigo}" />
			</p:column>

			<p:column sortBy="#{sp.produto.descricao}">
				<f:facet name="header">  
                   #{message.produto_descricao}  
            	</f:facet>
				<h:outputText
					value="#{sp.produto.descricao} (#{sp.produto.unidMedida})" />
			</p:column>


			<p:column>
				<f:facet name="header">  
                   #{message.produto_qtde}  
            	</f:facet>
				<h:outputText value="#{sp.qtdOrigem}">
					<f:convertNumber pattern="#0.000" />
				</h:outputText>
			</p:column>

			<p:column>
				<f:facet name="header">  
                   #{message.produto_qtde} Env. 
            	</f:facet>
				<h:outputText value="#{sp.qtdEnviada}">
					<f:convertNumber pattern="#0.000" />
				</h:outputText>
			</p:column>

			<p:column>
				<f:facet name="header">  
                   #{message.solicita_dt_emissao}  
            	</f:facet>
				<h:outputText value="#{sp.dataEmissao}">
					<f:convertDateTime pattern="dd/MM/yy" />
				</h:outputText>
			</p:column>


			<p:column>
				<f:facet name="header">  
                   #{message.produto_dt_necessidade2}  
            	</f:facet>
				<h:outputText value="#{sp.dataEntrega}">
					<f:convertDateTime pattern="dd/MM/yy" />
				</h:outputText>
			</p:column>

			<p:column>
				<f:facet name="header">  
                   #{message.solicita_solicitante}  
            	</f:facet>
				<h:outputText value="#{sp.solicitante}" />
			</p:column>

			<p:column>
				<f:facet name="header">  
                   #{message.solicita_status}  
            	</f:facet>
				<h:outputText
					value="#{sp.statusSp.descricao} (#{sp.statusSp.codigo})" />
			</p:column>

			<p:column>
				<f:facet name="header">  
                   Dt. Prg. 
            	</f:facet>
				<h:outputText value="#{sp.dataProgramacao}">
					<f:convertDateTime pattern="dd/MM/yy" />
				</h:outputText>
			</p:column>

			<p:rowExpansion>

				<f:event listener="#{listaSolicitaProdTela.atualizaExpansion(sp)}"
					type="preRenderComponent">
				</f:event>

				<h:outputText id="gradeAc" escape="false"
					value="#{listaSolicitaProdTela.htmlExpansion}" />

			</p:rowExpansion>

		</p:dataTable>

	</h:form>



</h:body>
</html>